<?php
namespace Plugin\Attractions\Broadcast\Schema\Broadcast_plans;

use Plugin\Attractions\Broadcast\Model\Broadcast_plans\BroadcastPlans;
use Hyperf\Swagger\Annotation\Property;
use Hyperf\Swagger\Annotation\Schema;

/**
 * 广播计划配置
 */
#[Schema(title: 'BroadcastPlansSchema')]
class BroadcastPlansSchema implements \JsonSerializable
{
    #[Property(property: 'id', title: '主键ID', type: 'bigint')]
    public string $id;

    #[Property(property: 'plan_name', title: '计划名称', type: 'varchar')]
    public string $plan_name;

    #[Property(property: 'plan_description', title: '计划描述', type: 'text')]
    public string $plan_description;

    #[Property(property: 'content_text', title: '广播文字内容', type: 'text')]
    public string $content_text;

    #[Property(property: 'content_audio_file', title: '音频文件路径', type: 'varchar')]
    public string $content_audio_file;

    #[Property(property: 'target_devices', title: '目标设备（JSON格式：设备ID数组）', type: 'array')]
    public string $target_devices;

    #[Property(property: 'target_groups', title: '目标分组（JSON格式：分组名称数组）', type: 'array')]
    public string $target_groups;

    #[Property(property: 'start_time', title: '开始时间，控制播放时间段', type: 'time')]
    public string $start_time;

    #[Property(property: 'end_time', title: '结束时间，控制播放时间段', type: 'time')]
    public string $end_time;

    #[Property(property: 'execution_day', title: '执行日期，逗号间隔，按不同重复类型', type: 'date')]
    public string $execution_day;

    #[Property(property: 'repeat_type', title: '重复类型：1-不重复，2-每天，3-每周，4-每月', type: 'tinyint')]
    public string $repeat_type;

    #[Property(property: 'repeat_interval', title: '重复间隔（分钟）', type: 'int')]
    public string $repeat_interval;

    #[Property(property: 'repeat_count', title: '重复次数', type: 'int')]
    public string $repeat_count;

    #[Property(property: 'trigger_event', title: '触发事件ID', type: 'int')]
    public string $trigger_event;

    #[Property(property: 'trigger_condition', title: '触发条件（JSON格式）', type: 'varchar')]
    public string $trigger_condition;

    #[Property(property: 'volume_day', title: '音量', type: 'tinyint')]
    public string $volume_day;

    #[Property(property: 'plan_status', title: '计划状态：1-草稿，2-待执行，3-执行中，4-已取消', type: 'tinyint')]
    public string $plan_status;

    #[Property(property: 'last_execution_time', title: '最后执行时间', type: 'timestamp')]
    public string $last_execution_time;

    #[Property(property: 'execution_count', title: '已执行次数', type: 'int')]
    public string $execution_count;

    #[Property(property: 'remark', title: '备注', type: 'text')]
    public string $remark;




    public function __construct(BroadcastPlans $model)
    {
       $this->id = $model->id;
       $this->plan_name = $model->plan_name;
       $this->plan_description = $model->plan_description;
       $this->content_text = $model->content_text;
       $this->content_audio_file = $model->content_audio_file;
       $this->target_devices = $model->target_devices;
       $this->target_groups = $model->target_groups;
       $this->start_time = $model->start_time;
       $this->end_time = $model->end_time;
       $this->execution_day = $model->execution_day;
       $this->repeat_type = $model->repeat_type;
       $this->repeat_interval = $model->repeat_interval;
       $this->repeat_count = $model->repeat_count;
       $this->trigger_event = $model->trigger_event;
       $this->trigger_condition = $model->trigger_condition;
       $this->volume_day = $model->volume_day;
       $this->plan_status = $model->plan_status;
       $this->last_execution_time = $model->last_execution_time;
       $this->execution_count = $model->execution_count;
       $this->remark = $model->remark;

    }

    public function jsonSerialize(): array
    {
        return ['id' => $this->id ,'plan_name' => $this->plan_name ,'plan_description' => $this->plan_description ,'content_text' => $this->content_text ,'content_audio_file' => $this->content_audio_file ,'target_devices' => $this->target_devices ,'target_groups' => $this->target_groups ,'start_time' => $this->start_time ,'end_time' => $this->end_time ,'execution_day' => $this->execution_day ,'repeat_type' => $this->repeat_type ,'repeat_interval' => $this->repeat_interval ,'repeat_count' => $this->repeat_count ,'trigger_event' => $this->trigger_event ,'trigger_condition' => $this->trigger_condition ,'volume_day' => $this->volume_day ,'plan_status' => $this->plan_status ,'last_execution_time' => $this->last_execution_time ,'execution_count' => $this->execution_count ,'remark' => $this->remark];
    }
}